<script setup lang="ts">
import Child from "@/components/Child.vue";
import {ref} from "vue";
const money = ref(100);
const son = ref();
const h3Ref = ref();
const fn = function(){
    // console.log(son.value.money)
    son.value.money-=10;
    money.value += 10;
}
</script>

<template>
    <h3 ref="h3Ref">App</h3>
    {{money}}
    <button @click="fn">向儿子借10元</button>
    <button @click="son.setMoney">调用子组件的函数</button>
    <hr/>
    <Child ref="son"/>
</template>

<style scoped>

</style>